<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" name="viewport" content="width-device-width,initial-scale=1">
    <title>长流跟打器</title>
    <script src="/js/jquery.min.js"></script>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/ajaxGetHtml.js"></script>
    <style>
        #MyInfoTable,#MyInfoTable th{
            text-align: center;
            margin: auto;
        }
    </style>
    <script type="text/javascript">

        var GetMyInfo = function () {
            $.ajax({
                type: 'POST',
                contentType: 'application/json;charset=utf-8',
                url: '/me/info/' + sessionStorage.sessionId,
                dataType: 'json',
                success: function (data) {
                    var message = data["message"];
                    if(message=="获取成功") {
                        data = data["result"];
                        let tr = $('#MyInfo');
                        tr.empty();
                        tr.append('<td>' + data.username + '</td>');
                        tr.append('<td>' + data.num + '</td>');
                        tr.append('<td>' + data.rightNum + '</td>');
                        tr.append('<td>' + data.misNum + '</td>');
                        tr.append('<td>' + data.dateNum + '</td>');
                        tr.append('<td>' + data.lastLoginDate + '</td>');
                        tr.append('<td>' + data.regDate + '</td>');
                    }else
                        alert(message);
                },
                error: function (err) {
                    alert("拉取失败");
                }
            })
        }
        $(function () {
            GetMyInfo();
        })
    </script>
    <title>Title</title>
</head>
<body>
<div th:include="public/header"></div>
<div class="panel panel-default">
    <div class="panel-body">
        <div class="table-responsive" id="MyInfoTable">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                <tr>
                    <th>用户名</th>
                    <th>总字数</th>
                    <th>正确字数</th>
                    <th>错误字数</th>
                    <th>今日字数</th>
                    <th>最后登录日期</th>
                    <th>注册日期</th>
                </tr>
                </thead>
                <tbody>
                <tr id="MyInfo"></tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div th:include="public/footer"></div>
</body>
</html>